package vno.fux.events
{
	import flash.events.Event;
	import vno.fux.BasePoint;
	import vno.fux.CompassDirection;
	import flash.geom.Point;
	
	public class MapEvent extends Event
	{
		public static var MOVE:String = "Move";
		public static var DIRECTION:String = "Direction";
		public static var START_MOVE:String = "Start_Move";
		public static var END_MOVE:String = "End_Move";
		public static var UNREACH:String = "Unreachable";
		private var _pos:BasePoint;
		private var _direction:String;
		private var _infos:Object;
		
		public function MapEvent(type:String,opts:Object=null)
		{
			super(type);
			// if(opts)
			// {
			// 	_pos		= opts["pos"]?opts["pos"]:null;
			// 	_direction	= opts["direction"]?opts["direction"]:null;
			// }
			if(!opts)
			{
				_infos = {};
			}
			else
			{
				_infos = opts;
			}
		}

		public function get pos():BasePoint
		{
			return _infos["pos"];
		}
		public function get direction():String
		{
			return _infos["direction"];
		}
		public function get start():BasePoint
		{
			return _infos["start"];
		}
		public function get end():BasePoint
		{
			return _infos["end"];
		}
		public function get roadValue():int
		{
			return _infos["roadValue"];
		}
		public function get infos():Object
		{
			return _infos;
		}
		override public function clone():Event
		{
			return new MapEvent(type, _infos);
		}
		override public function toString():String
		{
			return formatToString("MapEvent", "type", "pos", "direction", "bubbles", "start", "end", "cancelable", "eventPhase");
		}
//		override public function formatToString(className:String, ...parameters):String
//		{
//			var str = "["+className+" ";
//			for each(var prop in parameters)
//			{
//				try
//				{
//					str += prop+"="+this[prop]+" ";
//				}
//				catch(e:Error)
//				{
//					str += prop+"=null "
//				}
//			}
//			str+="]";
//			return str;
//		}

	}
}